﻿//-----------------------------------------------------------------
//
// @(#)$Id: ProgCategory.aspx.cs,v 1.0 2013/12/16 9:51:11 lichunhua Exp $
// @(#)$Author: lichunhua  $
// @(#)$Date: 2013/12/16 9:51:11 $
// @(#)$Description:
//
//
//
//                 All Rights Reserved.
//-----------------------------------------------------------------
using System;
using System.Web.UI.HtmlControls;
using ebay.Dal.CenterDB_SystemTableAdapters;

public partial class UI_SysSet_ProgCategory : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        WebUtility.CheckRight();
        if (!IsPostBack)
        {
            Bind();
        }
    }

    void Bind()
    {
        T_ProgContextTableAdapter adapter = new T_ProgContextTableAdapter();
        Repeater1.DataSource = adapter.GetProgAll();
        Repeater1.DataBind();
        MegreCell();
    }

    void MegreCell()
    {
        for (int i = Repeater1.Items.Count - 1; i > 0; i--)
        {
            HtmlTableCell oCell_previous = Repeater1.Items[i - 1].FindControl("sysname") as HtmlTableCell;
            HtmlTableCell oCell = Repeater1.Items[i].FindControl("sysname") as HtmlTableCell;

            oCell.RowSpan = (oCell.RowSpan == -1) ? 1 : oCell.RowSpan;
            oCell_previous.RowSpan = (oCell_previous.RowSpan == -1) ? 1 : oCell_previous.RowSpan;

            if (oCell.InnerText == oCell_previous.InnerText)
            {
                oCell.Visible = false;
                oCell_previous.RowSpan += oCell.RowSpan;
            }

            HtmlTableCell oCell_previous1 = Repeater1.Items[i - 1].FindControl("subsysname") as HtmlTableCell;
            HtmlTableCell oCell1 = Repeater1.Items[i].FindControl("subsysname") as HtmlTableCell;

            oCell1.RowSpan = (oCell1.RowSpan == -1) ? 1 : oCell1.RowSpan;
            oCell_previous1.RowSpan = (oCell_previous1.RowSpan == -1) ? 1 : oCell_previous1.RowSpan;

            if (oCell1.InnerText == oCell_previous1.InnerText)
            {
                oCell1.Visible = false;
                oCell_previous1.RowSpan += oCell1.RowSpan;
            }
        }

    }
}
